 // PageLoad事件   
var onloadMethod = window.onload;   
window.onload = window_Load;   
function window_Load() {   
var i;   
var item;   
// 全部连接的事件   
for (i = 0; i < document.links.length; i ++) {   
item = document.links[i]   
Object.Aspect.around(item, "onclick", checkLoading);   
}   
// 全部按钮的事件   
for (i = 0; i < document.forms[0].elements.length; i ++) {   
item = document.forms[0].elements[i]   
if (item.type == "button" ||   
item.type == "submit" ||   
item.type == "reset") {   
Object.Aspect.around(item, "onclick", checkLoading);   
}   
}   
if (onloadMethod != null && typeof (onloadMethod) == "function") {   
// 执行Page的onload事件   
return onloadMethod();   
} else {   
return true;   
}   
}   
// 防止重复提交   
var checkLoading = function(invocation) {   
if (isDocumentLoading()) {   
//alert("now loading…");   
return false;   
}   
return invocation.proceed();   
}   
// 当前页面提交状态判断   
function isDocumentLoading() {   
return (document.readyState != null &&   
document.readyState != "complete" &&   
document.readyState != "interactive");   
}   
// Aspect 用   
Object.Aspect = {   
_around: function(target, methodName, aspect) {   
var method = target[methodName];   
target[methodName] = function() {   
var invocation = {   
"target" : this,   
"method" : method,   
"methodName" : methodName,   
"arguments" : arguments,   
"proceed" : function() {   
if (!method) {   
return true;   
}   
return method.apply(target, this.arguments);   
}   
};   
return aspect.apply(null, [invocation]);   
};   
},   
around: function(target, methodName, aspect) {   
this._around(target, methodName, aspect);   
}   
} 